Skip to content

prioritise dict method when serialising#75

Merged
Jammy2211 merged 3 commits intomainfrom
feature/constant
May 31, 2025
Merged

prioritise dict method when serialising#75
Jammy2211 merged 3 commits intomainfrom
feature/constant

Conversation

@rhayes777
Copy link
Copy Markdown
Collaborator

No description provided.

@Jammy2211
Copy link
Copy Markdown
Collaborator

Should this require kment to regenerate results?

@Jammy2211
Copy link
Copy Markdown
Collaborator

The code I run now gets an error earlier on:

  warnings.warn(problem)
Aggregator loading search_outputs... could take some time.

 A total of 1 search_outputs and results were found.
Traceback (most recent call last):
  File "/mnt/c/Users/Jammy/Results/euclid/paper/example.py", line 90, in <module>
    for fit_list, search in zip(fit_gen, agg.values("search")):
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoFit/autofit/aggregator/base.py", line 67, in func_gen
    return self.object_via_gen_from(fit=fit)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoLens/autolens/aggregator/fit_imaging.py", line 150, in object_via_gen_from
    return _fit_imaging_from(
           ^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoLens/autolens/aggregator/fit_imaging.py", line 54, in _fit_imaging_from
    dataset_list = _imaging_from(fit=fit)
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoGalaxy/autogalaxy/aggregator/imaging/imaging.py", line 48, in _imaging_from
    mask, header = agg_util.mask_header_from(fit=fit)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoGalaxy/autogalaxy/aggregator/agg_util.py", line 79, in mask_header_from
    header = aa.Header(header_sci_obj=fit.value(name=name)[0].header)
                                      ~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

It would suggest this has broken the loading of .fits files via the Aggregator I think.

@Jammy2211
Copy link
Copy Markdown
Collaborator

Ok, I get the error I used to now, it seems like the issue was your branch feature/constant spawned off an extremely old main branch :s

Traceback (most recent call last):
  File "/mnt/c/Users/Jammy/Results/euclid/paper/example.py", line 138, in <module>
    vmax = np.max(fit.model_images_of_planes_list[-1])
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoLens/autolens/imaging/fit_imaging.py", line 232, in model_images_of_planes_list
    galaxy_model_image_dict = self.galaxy_model_image_dict
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoLens/autolens/imaging/fit_imaging.py", line 164, in galaxy_model_image_dict
    galaxy_blurred_image_2d_dict = self.tracer.galaxy_blurred_image_2d_dict_from(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoGalaxy/autogalaxy/operate/image.py", line 401, in galaxy_blurred_image_2d_dict_from
    galaxy_image_2d_not_operated_dict = self.galaxy_image_2d_dict_from(
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoLens/autolens/lens/tracer.py", line 604, in galaxy_image_2d_dict_from
    traced_grid_list = self.traced_grid_2d_list_from(grid=grid)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoArray/autoarray/structures/decorators/to_grid.py", line 144, in wrapper
    return GridMaker(func=func, obj=obj, grid=grid, *args, **kwargs).result
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoArray/autoarray/structures/decorators/abstract.py", line 116, in result
    return self.via_grid_2d(self.evaluate_func)
                            ^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoArray/autoarray/structures/decorators/abstract.py", line 97, in evaluate_func
    return self.func(self.obj, self.grid, *self.args, **self.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoLens/autolens/lens/tracer.py", line 266, in traced_grid_2d_list_from
    grid_2d_list = tracer_util.traced_grid_2d_list_from(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoLens/autolens/lens/tracer_util.py", line 145, in traced_grid_2d_list_from
    scaling_factor = cosmology.scaling_factor_between_redshifts_from(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoGalaxy/autogalaxy/cosmology/lensing.py", line 258, in scaling_factor_between_redshifts_from
    self.angular_diameter_distance_z1z2(z1=redshift_0, z2=redshift_1)
  File "/home/jammy/venv/PyAutoOld/lib/python3.12/site-packages/astropy/cosmology/flrw/base.py", line 1300, in angular_diameter_distance_z1z2
    return self._comoving_transverse_distance_z1z2(z1, z2) / (z2 + 1.0)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jammy/venv/PyAutoOld/lib/python3.12/site-packages/astropy/cosmology/flrw/base.py", line 1210, in _comoving_transverse_distance_z1z2
    dc = self._comoving_distance_z1z2(z1, z2)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jammy/venv/PyAutoOld/lib/python3.12/site-packages/astropy/cosmology/flrw/base.py", line 1123, in _comoving_distance_z1z2
    return self._integral_comoving_distance_z1z2(z1, z2)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jammy/venv/PyAutoOld/lib/python3.12/site-packages/astropy/cosmology/flrw/base.py", line 1161, in _integral_comoving_distance_z1z2
    return self._hubble_distance * self._integral_comoving_distance_z1z2_scalar(z1, z2)  # fmt: skip
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jammy/venv/PyAutoOld/lib/python3.12/site-packages/astropy/cosmology/_utils.py", line 61, in wrapper
    return func(self, *zs, *args[nin:], **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jammy/venv/PyAutoOld/lib/python3.12/site-packages/astropy/cosmology/flrw/base.py", line 1143, in _integral_comoving_distance_z1z2_scalar
    return quad(self._inv_efunc_scalar, z1, z2, args=self._inv_efunc_scalar_args)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jammy/venv/PyAutoOld/lib/python3.12/site-packages/scipy/integrate/_quadpack_py.py", line 459, in quad
    retval = _quad(func, a, b, args, full_output, epsabs, epsrel, limit,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jammy/venv/PyAutoOld/lib/python3.12/site-packages/scipy/integrate/_quadpack_py.py", line 606, in _quad
    return _quadpack._qagse(func,a,b,args,full_output,epsabs,epsrel,limit)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: must be real number, not Constant

@Jammy2211 Jammy2211 merged commit 36a2dc6 into main May 31, 2025
8 checks passed
@Jammy2211 Jammy2211 deleted the feature/constant branch June 24, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants